#include "graph.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 205;
int stk[N],de[N],tp;
int dfcnt;
int T[N][N],W[N][N],cur[N],fe[N],fa[N],pw[N];
int f[N][N],cnt[N];
void Inspect(int R) {
    stk[++tp] = ++dfcnt;
    de[1] = NumberOfRoads();
    //cerr<<"YES\n"<<de[1]<<"\n";
    cur[1] = 0;//当前走到1
    while(tp)
    {
        int x = stk[tp];
        cur[x]++;
        //cout<<"YES\n"<<x<<"\n";
        while(cur[x] <= de[x])
        {
            if(cur[x] == fe[x])
            {
                cur[x]++;
                continue;
            }
            Move(cur[x],2);
            //cerr<<"MOVE"<<x<<" "<<cur[x]<<" "<<Color()<<"\n";
            if(Color() == 1)//新点
            {
                stk[++tp] = ++dfcnt;
                //cerr<<x<<" "<<cur[x]<<" "<<dfcnt<<"\n";
                fe[dfcnt] = LastRoad();
                de[dfcnt] = NumberOfRoads();
                T[dfcnt][fe[dfcnt]] = x;
                W[x][cur[x]] = dfcnt;//记录这是树上边
                fa[dfcnt] = x;
                break;//然后继续dfs下去
            }
            else if(Color() == 2)//返祖，回头
            {
                int tmp = LastRoad();
                T[x][cur[x]] = 1;//先加1
                Move(tmp,2);
            }
            else if(Color() == 3)//前向，记录，然后回头
            {
                int tmp = LastRoad();
                W[x][cur[x]] = -1;
                Move(tmp,3);
            }
            cur[x]++;
        }
        if(cur[x] > de[x])
        {
            tp--;
            if(tp) Move(fe[x],3);
        }
    }
    int s = 1;
    for(int i = 1;i <= dfcnt;i++) cur[i] = 0;
    pw[0] = 1;
    for(int i = 1;i < 5;i++) pw[i] = pw[i-1]*3;
    for(int i = 0;i < 5;i++)
    {
        stk[tp = 1] = 1;
        for(int j = 1;j <= dfcnt;j++) cur[j] = 0;
        while(tp)
        {
            int x = stk[tp];
            cur[x]++;
            while(cur[x] <= de[x])
            {
                if(cur[x] == fe[x])
                {
                    cur[x]++;
                    continue;//回头边跳过
                }
                if(W[x][cur[x]] > 0)//树上边dfs下去
                {
                    stk[++tp] = W[x][cur[x]];
                    Move(cur[x],((x-1)/pw[i])%3+1);
                    break;//然后继续dfs下去
                }
                else if(W[x][cur[x]] == 0)//返祖，处理
                {
                    Move(cur[x],((x-1)/pw[i])%3+1);
                    int tmp = LastRoad(),col = Color();
                    T[x][cur[x]] += pw[i]*(col-1);
                    Move(tmp,col);
                }
                cur[x]++;
            }
            if(cur[x] > de[x])
            {
                tp--;
                if(tp) Move(fe[x],((x-1)/pw[i])%3+1);//退出
            }
        }
    }
    memset(f,0x3f,sizeof(f));
    int S = 0,S2 = 0;
    for(int i = 1;i <= dfcnt;i++)
    {
        S += de[i];
        f[i][i] = 0;
        for(int j = 1;j <= de[i];j++)
        {
            if(W[i][j] == -1 || j == fe[i]) continue;//前向边与树上反边
            else if(W[i][j])
            {
                if(f[W[i][j]][i] == 1) S2--;
                f[W[i][j]][i] = f[i][W[i][j]] = 1,S2++;
                //cerr<<"!"<<i<<" "<<W[i][j]<<"\n";
            }//,cerr<<"!"<<i<<" "<<W[i][j]<<"\n";//树上边
            else
            {
                if(f[T[i][j]][i] == 1) S2--;
                f[T[i][j]][i] = f[i][T[i][j]] = 1,S2++;
                //cerr<<"!"<<i<<" "<<T[i][j]<<"\n";//返祖边
            }
        }
    }
    for(int i = 1;i <= dfcnt;i++) for(int x = 1;x <= dfcnt;x++) for(int y = 1;y <= dfcnt;y++) f[x][y] = min(f[x][y],f[x][i]+f[i][y]);
    for(int i = 1;i <= dfcnt;i++) for(int j = i+1;j <= dfcnt;j++) cnt[f[i][j]]++;
    for(int i = 1;i <= R;i++) Answer(i,cnt[i]);
}
